import axios from 'axios'; 
import type {
  Result,
} from './typings';

/**
 * 获取用户列表 GET /api/user
 */
export async function get_api_user (
  options?: Record<string, any>,
): Promise<Result<any>> {
  return axios({
    method: 'GET',
    url: `/api/user`,
    ...(options || {}),
  })
}

/**
 * 用户登录 POST /api/user/login
 */
export async function post_api_user_login (
  data: {
    /** 用户密码 */
    password?: string;
    /** 用户账号 */
    username?: string;
  },
  options?: Record<string, any>,
): Promise<Result<any>> {
  return axios({
    method: 'POST',
    url: `/api/user/login`,
    data: {
      ...data,
    },
    ...(options || {}),
  })
}
